<template>
  <div class="FavoritesItems">
    <van-list
      v-model="loading"
      :finished="finished"
      :finished-text="moreListMsg"
      @load="onLoad"
    >
      <div class="FavoritesLF">
        <!-- 左边图片 -->
        <img
          class="imgLF"
          :src="`http://liufusong.top:8080${FavoritesItems.houseImg}`"
          alt=""
        />

        <!-- 右边详情 -->
        <div class="right">
          <h3>{{ FavoritesItems.title }}</h3>
          <p class="desc">{{ FavoritesItems.desc }}</p>
          <div class="tags">
            <span
              class="tag-item"
              v-for="item in FavoritesItems.tags"
              :key="item"
              >{{ item }}</span
            >
          </div>
          <div class="price">
            <span class="hou-price">{{ FavoritesItems.price }}</span
            >元/月
          </div>
        </div>
      </div>
    </van-list>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    FavoritesItems: {
      type: [Array, Object],
      required: true,
    },
    MyfavoritesDataLength: {
      type: [String, Number],
      required: true,
    },
  },
  data() {
    return {
      list: [],
      loading: true,
      finished: true,
      moreListMsg: "", //没有更多收藏
    };
  },
  created() {
    return this.MyfavoritesDataLength >= 6
      ? (this.moreListMsg = "没有更多收藏喽，亲")
      : (this.moreListMsg = "你的收藏太少啦");
  },
  watch: {},
  methods: {
    onLoad() {
      // // 异步更新数据
      // // setTimeout 仅做示例，真实场景中一般为 ajax 请求
      // setTimeout(() => {
      //   for (let i = 0; i < 10; i++) {
      //     this.list.push(this.list.length + 1);
      //   }
      //   // 加载状态结束
      //   this.loading = false;
      //   // 数据全部加载完成
      //   if (this.list.length >= 40) {
      //     this.finished = true;
      //   }
      // }, 1000);
    },
  },
};
</script>

<style lang="less" scoped>
.FavoritesItems {
  margin-top: 8px;
  width: 94%;
  height: 126px;
  margin: auto;
  border-bottom: 0.2px solid rgba(175, 175, 175, 0.25);
  .FavoritesLF {
    display: flex;
    .imgLF {
      background-size: contain;
      margin-left: 8px;
      height: 92px;
      width: 120px;
      background-color: rgb(69, 0, 0);
      margin-top: 13px;
      border-radius: 6px;
    }
    .right {
      margin-left: 15px;
      h3 {
        margin-top: 13px;
      }
      .desc {
        margin-top: -10px;
      }
      .tags {
        .tag-item {
          color: #57c6d3;
          background-color: #e1f5f8;
          padding: 3px;
          font-size: 12px;
          border-radius: 4px;
        }
        margin-top: -10px;
      }
      .price {
        color: #dd3d33;
        margin-top: 5.5px;
        .hou-price {
          font-size: 20px;
          font-weight: 700;
          padding-right: 5px;
        }
      }
    }
  }
}
</style>
